<!DOCTYPE html>
<!--
To change this license header, choose License Headers in Project Properties.
To change this template file, choose Tools | Templates
and open the template in the editor.
-->
<html>
    <head>
        <title>TODO supply a title</title>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <script src="Public/JqPlugin/jquery-1.11.3.min.js" type="text/javascript"></script>
        <script src="Public/JqPlugin/kindeditor-4.1.10/kindeditor-min.js" type="text/javascript"></script>
    </head>
    <body>
        <div><button type="button" id="btn-fix">修复内容</button></div>
        <div><textarea name="content" rows="36" cols="180"></textarea></div>
        <script type="text/javascript">
            var editor;
            KindEditor.ready(function (K) {
                editor = K.create('textarea[name="content"]', {
                    resizeType: 1,
                    allowPreviewEmoticons: false,
                    allowImageUpload: false,
                    items: ['undo', 'redo', '|',
                        'cut', 'copy', 'paste', 'plainpaste', 'wordpaste', 'selectall', 'clearhtml', '|',
                        'fontname', 'fontsize', '|', 'forecolor', 'hilitecolor', 'bold', 'italic', 'underline',
                        'removeformat', '|', 'justifyleft', 'justifycenter', 'justifyright', 'insertorderedlist',
                        'insertunorderedlist', '|', 'emoticons', 'image', 'link', '|', 'source', 'preview', 'fullscreen']
                });
            });
            $('#btn-fix').click(function(){
                var html=editor.html();
                console.log(html);
                html=html.replace(new RegExp('style="padding: 0px; margin: 0px 0px 15px; color: #2b2b2b; font-family: Arial, Verdana, 宋体, 微软雅黑; font-size: 14px; line-height: 22px; text-indent: 28px; background-color: #ffffff;"','gi'),'');
                html=html.replace(new RegExp('style="padding: 0px; margin: 0px;"','gi'),'');
                html=html.replace(new RegExp('padding: 0px; margin: 0px; ','gi'),'');
                html=html.replace(new RegExp(' vertical-align: text-bottom;','gi'),'');
                html=html.replace(new RegExp('<bac','gi'),'<span');
                html=html.replace(new RegExp('</bac>','gi'),'</span>');
                editor.html(html);
            })
        </script>
    </body>
</html>
